var mongoose = require('mongoose');
var util = require('util');

if (!process.argv[2] || !process.argv[3]) {
	var first = process.argv[2];
	var last = process.argv[3];
}

connection = mongoose.createConnection('mongodb://127.0.0.1/rush');
model = {};
require('../Models/User');

if (first && last) {
	model.User.update({
		firstName : first,
		lastName : last
	}, {
		events : [],
		comments : []
	}, function(e) {
		if (e) {
			util.puts('Shit.');
			util.puts(e.message);
			process.exit(1);
		} else {
			util.puts('Done.');
			process.exit(0);
		}
	});
} else {
	util.puts('Reset All');
	model.User.update({}, {
		events : [],
		comments : []
	}, {
		multi : true
	}, function(e) {
		if (e) {
			util.puts('Shit.');
			util.puts(e.message);
			process.exit(1);
		} else {
			util.puts('Done.');
			process.exit(0);
		}
	});
}
